#!/bin/bash
# Script to create group alias files, currently in use by Microbial
# subdirectory
# Author: Kevin Bealer
# Original date: 10/21/2005
# $URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/src/objtools/blast/seqdb_writer/build-alias-index $

INDEX_NAME=index.alx
OUTNAME=index.alx.new

: > $OUTNAME
echo "# Alias file index for" `pwd` >> $OUTNAME
echo "# Generated on `date`." >> $OUTNAME
echo "#" >> $OUTNAME

for i in `ls | egrep ".[pn]al\$"`
do
    echo -e "\nALIAS_FILE $i" >> $OUTNAME
    grep -v xxxx $i | grep -v "^\$" >> $OUTNAME
    echo >> $OUTNAME
done

mv $OUTNAME $INDEX_NAME

